<extend name="./Application/Common/View/block/base.php" />
<block name="header">
    <include file="block:easyui_header" />
    <link href="__PUBLIC__/css/admin_index.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="__PUBLIC__/js/adminLoadedThread.js"></script>
</block>
<block name="bdoy">
    <?php
        $key_to_value_model = D('KeyToValue');
    ?>
    <body>
        <div id="layout" class="easyui-layout" fit="true" style="width:100%;height:100%;">
            <div data-options="region:'north',title:'',split:false" class="header">
                <div class="top">
                    <div class="top-top">
                        <div class="logo">
                            <img src="{:get_kv_val('admin_logo')}" class="logo-img">
                        </div>
                        <div class="tool-div">
                            <div class="header_time">当前时间：<span id="current_time"></span></div>

                            <script>
                                self.setInterval("getNowFormatDate()",1000)
                            </script>
                            <ul class="tool-ul">
                                <li><a href="#" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon_ext icon-users'"><?php echo get_module_session('admin', 'realname');?></a></li>
                                <li><a href="javascript:addTab('修改密码','/Admin/Admin/change_pwd', 'icon_ext icon-listpipe', 1601)" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon_ext icon-edit'">修改密码</a></li>
                                <li><a href="/Admin/Login/loginOut" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon_ext icon-error'">退出</a></li>
                            </ul>
                        </div>
                    </div>

<!--                    <div class="easyui-tabs top-tab-div" id="tab" data-options="">-->
<!--                        <volist name="menus" id="menu">-->
<!--                            <div title="{:LANG($menu['name'])}" menu_id="{$menu['id']}"></div>-->
<!--                        </volist>-->
<!--                    </div>-->
                </div>
            </div>
            <div class="menu-div" data-options="region:'west',border:false,split:true,iconCls:'icon_ext icon-home'" title="{:LANG('admin_index_nav_title')}" style="width:200px;">
                <?php //echo D('Menu')->get_easyui_menu_tree();?>
<!--                <ul id="menu_tree" class="easyui-tree menu-tree" data-options="url:'__URL__/get_tree_menu?pid=1602',lines:true"></ul>-->
                <div class="easyui-accordion" id="accordion_div" data-options="" fit="true">
                    {$left_menu}
                </div>
            </div>
            <div data-options="region:'center',border:true,split:true" class=" main-content">
                <div id="tabs" class="easyui-tabs" fit="true" border="false" data-options="tools:'#tab-tools'"></div>
            </div>

        </div>
        <div id="tab-tools" style="padding-right: 50px;">
            <a href="javascript:void(0)" onclick="open_tab('/excelfile/system.pdf')" class="easyui-linkbutton" iconCls="icon-help" plain="true">系统帮助文档</a>
            <a href="javascript:void(0)" onclick="open_tab('/excelfile/app.pdf')" class="easyui-linkbutton" iconCls="icon-help" plain="true">APP使用文档</a>
            <a id="close" href="#" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="pickup()">收起</a>
            <a id="expand" href="#" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="expand()" style="display:none">展开</a>
        </div>
        <div id="mm" class="easyui-menu" style="width:150px;">
            <div id="mm-tabupdate">刷新</div>
            <div class="menu-sep"></div>
            <div id="mm-tabclose">关闭</div>
            <div id="mm-tabcloseall">全部关闭</div>
            <div id="mm-tabcloseother">除此之外全部关闭</div>
            <div class="menu-sep"></div>
            <div id="mm-tabcloseright">当前页右侧全部关闭</div>
            <div id="mm-tabcloseleft">当前页左侧全部关闭</div>
            <div class="menu-sep"></div>
            <div id="mm-exit">关闭快捷菜单</div>
        </div>

    </body>
</block>
<block name="footExtendJs">
    <script>
        var error_str = '';
        $(function(){
            $(window).resize(function() {
                $('#tabs').tabs('resize');
            });

            /*为选项卡绑定右键*/
            $(".tabs-inner").bind('contextmenu',function(e){
                $('#mm').menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });
                var subtitle =$(this).children(".tabs-closable").text();
                $('#mm').data("currtab",subtitle);
                $('#tabs').tabs('select',subtitle);
                return false;
            });
            tabCloseEven();
            addTab('{:get_kv_val('admin_welcome_tab_name')}', '{:get_kv_val('admn_welcome_page')}', '');
//            get_all_pump();
//            self.setInterval("get_all_pump()",100*60*1000);
        });

        function getNowFormatDate() {
            var date = new Date();
            var seperator1 = "-";
            var seperator2 = ":";
            var month = date.getMonth() + 1;
            var strDate = date.getDate();
            if (month >= 1 && month <= 9) {
                month = "0" + month;
            }
            if (strDate >= 0 && strDate <= 9) {
                strDate = "0" + strDate;
            }
            var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + date.getSeconds();
            $('#current_time').text(currentdate);
            return currentdate;
        }

        function get_all_pump(){
            var url = '/Manage/AdminPumpStation/get_all_facilities';
            $.getJSON(url, function(data){
                for(var i=0;i<data.length;i++){
                    var obj = data[i];
                    switch (obj.status){
                        case -1:
                            error_str += obj.name+',';
                            break;
                        default  :
                            break;
                    }
                }
                get_all_csdt();
            })
        }

        function get_all_csdt(){
            var url = '/Manage/AdminCsdt/get_all_facilities';
            $.getJSON(url, function(data){
                for(var i=0;i<data.length;i++){
                    var obj = data[i];
                    switch (obj.status){
                        case -1:
                            error_str += obj.name+',';
                            break;
                        default  :
                            break;
                    }
                }
                get_all_gate();
            })
        }

        function get_all_gate(){
            var url = '/Manage/AdminGate/get_all_facilities';
            $.getJSON(url, function(data){
                for(var i=0;i<data.length;i++){
                    var obj = data[i];
                    switch (obj.status){
                        case -1:
                            error_str += obj.name+',';
                            break;
                        default  :
                            break;
                    }
                }
                if(error_str != ''){
                    error_str = error_str+'设施出现故障，请打开公共排水泵站菜单查看';
                    $.messager.show({title:'提示',msg:error_str,timeout:0});
                }
                error_str = '';
            })
        }
    </script>




    </script>
</block>
